#导包
import time
from appium import webdriver
from selenium.webdriver.common.by import By

#准备测试数据：appium url
url = "http://127.0.0.1:4723/wd/hub"

#准备测试数据
d = {
    "platformName":"Android", #平台名
    "deviceName":"BAL-AL80", #设备名
    "appPackage":"com.android.settings", #包名
    "appActivity":".Settings"
}

#连接手机,创建驱动
driver = webdriver.Remote(url, d)
time.sleep(3)

#定位并点击放大镜
driver.find_element(By.ID, "com.android.settings:id/search").click()
time.sleep(3)
#定位搜索框，输入“应用”
driver.find_element(By.ID, "android:id/search_src_text").send_keys("应用")
time.sleep(3)
#定位并点击“返回”按钮
driver.find_element(By.CLASS_NAME, "android.widget.ImageButton").click()
time.sleep(10)


#关闭驱动
driver.quit()


